home *** CD-ROM | disk | FTP | other *** search
- Path: in2.uu.net!usc!comserv-i-62
- From: wawda@scf.usc.edu (Abu Wawda)
- Newsgroups: comp.lang.c
- Subject: Help with gettng 2 chars into an integer!
- Date: 11 Jan 1996 07:33:53 GMT
- Organization: University of Southern California, Los Angeles, CA
- Sender: wawda@comserv-i-62.usc.edu
- Message-ID: <4d2eh1$7pm@usc.edu>
- NNTP-Posting-Host: comserv-i-62.usc.edu
-
-
- Hi. I can't seem to figure out how to do this. Basically I have to chars that
- I want to put into a 2-byte integer. It seems easy at first, but I can't seem
- to figure out to do it with the bit-fidling operators (shifting or masking).
- Simple put, I'd like to do:
-
- char a,b;
- int c;
-
- a = 'A';
- b = 'B';
- c = ? /* the first byte in c should contain the value of a, and the
- second byte should contain the value of b */
-
- Please help! Thanks in advance,
-
- =====================================================================.
- | Abu Wawda | wawda@scf.usc.edu | http://www-scf.usc.edu/~wawda/ |
- | ------------------------------------------------------------------- |
- | "The world is a comedy to those who think, | Live Long |
- | a tragedy to those who feel." -H. Walpole | and Prosper. |
- `====================================================================='
-